package subject_set.offer100;

/**
 * @author haomin
 * @date 2022/10/21 16:45
 **/
public class Offer46 {
    class Solution {
        int ans = 0;
        public int translateNum(int num) {
            dfs(Integer.toString(num), 0);
            return ans;
        }
        private void dfs(String str, int ind){
            if(ind == str.length()) {
                ans++;
                return;
            }
            if(ind + 1 < str.length() && str.charAt(ind) != '0' &&
                    ((str.charAt(ind)-'0')*10 + (str.charAt(ind+1) - '0')) < 26){
                dfs(str, ind + 2);
            }
            dfs(str, ind + 1);
        }
    }
}